﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace GraphAlgorithms {
	public class Edge : IComparable {
		private Vertex _u;
		public Vertex U {
			get { return _u; }
			set { _u = value; }
		}

		private Vertex _v;
		public Vertex V {
			get { return _v; }
			set { _v = value; }
		}

		double _weight = 0;
		public double Weight {
			get { return _weight; }
			set { _weight = value; }
		}

		public Edge() {}

		public Edge(Vertex u, Vertex v) {
			_u = u;
			_v = v;
		}

		public Edge(Vertex u, Vertex v, double weight) {
			_u = u;
			_v = v;
			_weight = weight;
		}

		public int CompareTo(object e) {
			if (this._weight.CompareTo(((Edge)e)._weight) == 0)
				return this._u.Name.CompareTo(((Edge)e)._u.Name);
			else return this._weight.CompareTo(((Edge)e)._weight);
		}
	}
}
